/*
	Copyright (C) 2008 by Jean-François Geyelin
	jfgeyelin@gmail.com

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the
	Free Software Foundation, Inc.,
	51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/*

#include "all.h"
#include "safeFileIO.h"

#ifndef NO_LIBCURL
    #include <curl/curl.h>
    #include <curl/types.h>
    #include <curl/easy.h>
#endif


void handleEvents(void);


int writeImage(void *ptr, size_t size, size_t nmemb, void *stream) {
    //((std::ostream*)stream)->write((const char*)ptr, size*nmemb);

    fwrite (ptr, size, nmemb, (FILE *)stream );

    PRINTF("received a packet for the downloaded image\n");
    return size*nmemb;
}



int getImage(void *ptr) {


    PRINTF("starting to download image\n");

    FILE *f = fopen_safe("message.png","wb+");

#ifndef NO_LIBCURL
    CURL *curl;
    CURLcode res;
    curl = curl_easy_init();
    if(curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "http://deskowner.googlepages.com/boo2.PNG");
        curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION, writeImage);

        curl_easy_setopt(curl,CURLOPT_WRITEDATA, f);
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
    }
    //  *((int*)ptr) = atoi(o.str().c_str());
#endif
    fclose(f);

    return 0;
}


*/
/*
void getImageFromServer(void) {
    SDL_Thread *thread;
   // thread = SDL_CreateThread(getImage, NULL);

    if (*seed==0) {
        SDL_KillThread(thread);
        return false;
    }
}
*/

